package abg.manage.web;


import abg.core.domain.db.Demo;
import abg.core.mapper.DemoMapper;
import abg.core.service.demo.DemoService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

/**
 * 项目启动完成监听
 */
@Slf4j
@Configuration
public class WebListener implements ApplicationListener<WebServerInitializedEvent> {
    @Resource
    private DemoService demoService;

    @Resource
    private DemoMapper demoMapper;

    @Override
    public void onApplicationEvent(@NotNull WebServerInitializedEvent webServerInitializedEvent) {
        demoService.insert(new Demo());

        Demo info = demoService.info("1");
        System.out.println(info);

        Demo demo = demoMapper.selectColumnById("2");
        System.out.println(demo);

        System.out.println();
    }

}
